package cloud.ben.smallscalepigfarmmanagementsystem.entity.drug;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Author: Ben
 * @Date: 2022/3/29 21:52
 */
@Data
@TableName("drug")
@ApiModel(description = "药品信息表")
@ToString
@NoArgsConstructor
public class Drug {

    /**
     * 药品id
     */
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(required = true,value = "药品id")
    private Integer id;

    /**
     * 药名
     */
    @ApiModelProperty(required = true,value = "药名")
    @NotNull(message = "药名为空")
    private String drugName;

    /**
     *药品生成工厂
     */
    @ApiModelProperty(required = true,value = "药品生成工厂")
    @NotNull(message = "药品生成工厂为空")
    private String drugFactory;

    /**
     *保质期
     */
    @ApiModelProperty(required = true,value = "过期时间")
    @NotNull(message = "保质期为空")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date expirationTime;

    /**
     * 库存
     */
    @ApiModelProperty(required = true,value = "库存")
    @NotNull(message = "库存为空")
    private Integer inventory;


    public Drug(Integer id, String drugName, String drugFactory, Date expirationTime, Integer inventory) {
        this.id = id;
        this.drugName = drugName;
        this.drugFactory = drugFactory;
        this.expirationTime = expirationTime;
        this.inventory = inventory;
    }


    public Drug(String drugName, String drugFactory, Date expirationTime, Integer inventory) {
        this.drugName = drugName;
        this.drugFactory = drugFactory;
        this.expirationTime = expirationTime;
        this.inventory = inventory;
    }
}
